<?
//error_reporting(0);
require("config.php");
//require("bin/encoding.php");

function flashencode($str){
  $str=eregi_replace("&","%26",$str);
	/*
$str=urlEncode($str);  
*/
  return $str;
}
/*
$CharEncoding=new Encoding(); 
$CharEncoding->SetGetEncoding("GBK")||die("Encode Error!"); 
$CharEncoding->SetToEncoding("UTF-8")||die("Encode Error!"); 


function conv($str){
	global $CharEncoding;
	return $CharEncoding->EncodeString($str); 
}
*/
function unichr($dec) {
  if ($dec < 128) {
   $utf = chr($dec);
  } else if ($dec < 2048) {
   $utf = chr(192 + (($dec - ($dec % 64)) / 64));
   $utf .= chr(128 + ($dec % 64));
  } else {
   $utf = chr(224 + (($dec - ($dec % 4096)) / 4096));
   $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64));
   $utf .= chr(128 + ($dec % 64));
  }
  return $utf;
}

$table = "med_announcement";

$field = array(

"id",
"subject",
"details",
"picture",

);

$exp = "Order By order_index asc, id desc Limit 10";

$r = limitQuery($table,$field,$exp);

//echo count($r);echo "<pre>";print_R($r);exit;

for($i=0;$i<count($r);$i++){
	
	$ids  = $ids . "~@:_" . $r[$i][0];
	$names  = $names . "~@:_" . $r[$i][1];
	$details  = $details . "~@:_" . $r[$i][2];
	$pictures  = $pictures . "~@:_" . $r[$i][3];

}

$ids  = $ids . "~@:_";
$names  = $names . "~@:_";
$details  = $details . "~@:_";
$pictures  = $pictures . "~@:_";

echo $ids;echo "<br>";
//print("&ids="  . substr($ids,4));
print("&pictures="  . flashencode(substr($pictures,4)));
//print("&names="  . utf8_encode(substr($names,4)));
//print("&details="  . utf8_encode(substr($details,4)));
//print("&pictures="  . flashencode(substr($pictures,4)));
//print("&pic_dir=../pictures_da/" . $table . "/");
//print("&readinfo=true");
?>